<?php if (!defined('THINK_PATH')) exit();?>

 <!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <title>Bootstrap Admin</title>
    <meta content="IE=edge,chrome=1" http-equiv="X-UA-Compatible">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="">

    <link rel="stylesheet" type="text/css" href="/TPproject/project/Public/Admin/Css/bootstrap.css">
    
    <link rel="stylesheet" type="text/css" href="/TPproject/project/Public/Admin/Css/theme.css">
    <link rel="stylesheet" href="/TPproject/project/Public/Admin/Css/font-awesome.css">

    <script src="/TPproject/project/Public/Admin/Js/jquery-1.7.2.min.js" type="text/javascript"></script>
    <script type="text/javascript" src="/TPproject/project/Public/Admin/Js/layer.js"></script>
    <script type="text/javascript" src="/TPproject/project/Public/Admin/static/h-ui/js/H-ui.min.js"></script>
    <script type="text/javascript" src="/TPproject/project/Public/Admin/static/h-ui.admin/js/H-ui.admin.js"></script>

    <script src="/TPproject/project/Public/Admin/Js/jquery.validation/jquery.validate.js" type="text/javascript"></script>


    <!-- Demo page code -->

    <style type="text/css">
        #line-chart {
            height:300px;
            width:800px;
            margin: 0px auto;
            margin-top: 1em;
        }
        .brand { font-family: georgia, serif; }
        .brand .first {
            color: #ccc;
            font-style: italic;
        }
        .brand .second {
            color: #fff;
            font-weight: bold;
        }
        .table>thead>tr>th
        {
          text-align: center;
        }
        .table>tbody>tr>td
        {
          text-align: center;
        }
    </style>



 
    <link rel="shortcut icon" href="/TPproject/project/Public/Admin/Img/favicon.ico">
    <link rel="apple-touch-icon-precomposed" sizes="144x144" href="/TPproject/project/Public/Admin/Img/apple-touch-icon-144-precomposed.png">
    <link rel="apple-touch-icon-precomposed" sizes="114x114" href="/TPproject/project/Public/Admin/Img/apple-touch-icon-114-precomposed.png">
    <link rel="apple-touch-icon-precomposed" sizes="72x72" href="/TPproject/project/Public/Admin/Img/apple-touch-icon-72-precomposed.png">
    <link rel="apple-touch-icon-precomposed" href="/TPproject/project/Public/Admin/Img/apple-touch-icon-57-precomposed.png">
  </head>
        
        

        <div class="container-fluid">
            <div class="row-fluid">
                    
<div class="btn-toolbar">
    <button class="btn btn-primary" id="submit"><i class="icon-save"></i> 提交</button>
    <!-- <a href="#myModal" data-toggle="modal" class="btn">删除</a> -->
  <div class="btn-group">
  </div>
</div>
<div class="well">
    
    <div id="myTabContent" class="tab-content">
      <div class="tab-pane active in" id="home">
    <form id="tab" method="post">
        <label>权限名称</label>
        <input type="text" value="<?php echo ($auth["auth_name"]); ?>" class="input-xlarge" id="auth_name" name='auth_name'>
        
        

          <label>父级权限</label>
          <select name="pid" id="pid" class="input-xlarge">
            <option value="0">==请选择==</option>
            <?php if(is_array($list)): $i = 0; $__LIST__ = $list;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?><option value="{vo.auth_id}" <?php if($vo['auth_id'] == $auth['pid']): ?>selected<?php endif; ?>><?php echo ($vo["auth_name"]); ?></option>
              <?php if(is_array($vo['child'])): $i = 0; $__LIST__ = $vo['child'];if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vol): $mod = ($i % 2 );++$i;?><option value="<?php echo ($vol["auth_id"]); ?>" <?php if($vol['auth_id'] == $auth['pid']): ?>selected<?php endif; ?>> &nbsp; &nbsp;|`<?php echo ($vol["auth_name"]); ?></option><?php endforeach; endif; else: echo "" ;endif; endforeach; endif; else: echo "" ;endif; ?>
          </select>

        <label>模块名称</label>
        <input type="text" value="<?php echo ($auth["auth_module"]); ?>" class="input-xlarge" id="auth_module" name='auth_module'>
        <label>控制器名称</label>
        <input type="text" value="<?php echo ($auth["auth_controller"]); ?>" class="input-xlarge" id="auth_controller" name='auth_controller'>
        <label>方法名称</label>
        <input type="text" value="<?php echo ($auth["auth_action"]); ?>" class="input-xlarge" id="auth_action" name='auth_action'>
         
          
        <label>是否显示</label>
        <select name='auth_type' style="width:100px">
          <option value="0" <?php if($auth['auth_type'] == 0): ?>selected<?php endif; ?>>隐藏</option>
          <option value="1" <?php if($auth['auth_type'] == 1): ?>selected<?php endif; ?>>显示</option>
        </select>
        

       

    </form>
      </div>
      
  </div>

</div>


<!-- </div> -->


<script type="text/javascript">




  function auth_name_blur(){
      var auth_name = $('#auth_name').val();
      if(auth_name==''){
        layer.msg('权限名称必须！',{icon:2,time:1000});return false;
      }else{
        return true;
      }
  }


  $('#auth_name').blur(function(){
      auth_name_blur();
  })

 


  $("#submit").click(function(){
 

      //提交前确认信息无误
      if(auth_name_blur()){
        
          $.post("",$("#tab").serialize(),function(msg){
              if(msg.code=='1'){
                layer.msg(msg.info,{icon:1,time:1000},function(index){
                  window.parent.location.reload();
                });

              }else{
                layer.msg(msg.info,{icon:2,time:1000});
                return false;
              }
          })
        
      }
      


      
  })
  
</script>